From 41acf893f61e0e56e0becbac56c336b03d81096c Mon Sep 17 00:00:00 2001 From: Alex Monk Date: Sat, 22 Dec 2012 20:12:09 +0000 Subject: [PATCH] Tweak login/account creation for logged in users * Don't show the "Don't have an account? [Join ]" box to logged-in users. * Use different message for "Real name" (disabled on WMF wikis) when creating another's account. Also document showCreateOrLoginLink() and set its visibility. Bug: 43172 Change-Id: I1b0bb6b78cbc5d37ef9f380a4bdf0f65d021a57f --- includes/specials/SpecialUserlogin.php | 12 +++++++----- includes/templates/Usercreate.php | 2 +- languages/messages/MessagesEn.php | 2 ++ languages/messages/MessagesQqq.php | 2 ++ maintenance/language/messages.inc | 1 + 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/includes/specials/SpecialUserlogin.php b/includes/specials/SpecialUserlogin.php index 13a91aae80..df1b16eb40 100644 --- a/includes/specials/SpecialUserlogin.php +++ b/includes/specials/SpecialUserlogin.php @@ -1209,14 +1209,16 @@ class LoginForm extends SpecialPage { } /** - * @private + * Whether the login/create account form should display a link to the + * other form (in addition to whatever the skin provides). * * @param $user User - * - * @return Boolean + * @return bool */ - function showCreateOrLoginLink( &$user ) { - if ( $this->mType == 'signup' ) { + private function showCreateOrLoginLink( &$user ) { + if ( $user->isLoggedIn() ) { + return false; + } elseif ( $this->mType == 'signup' ) { return true; } elseif ( $user->isAllowed( 'createaccount' ) ) { return true; diff --git a/includes/templates/Usercreate.php b/includes/templates/Usercreate.php index c7a0014693..3d848cf5e1 100644 --- a/includes/templates/Usercreate.php +++ b/includes/templates/Usercreate.php @@ -175,7 +175,7 @@ class UsercreateTemplate extends BaseTemplate { tabindex="7" value="text( 'realname' ); ?>" size='20' />
- msgWiki( 'prefs-help-realname' ); ?> + msgWiki( $this->data['createAnother'] ? 'createacct-another-realname-tip' : 'prefs-help-realname' ); ?>
'Your request to log out was denied because it looks like it was sent by a broken browser or caching proxy.', +'createacct-another-realname-tip' => 'Real name is optional. +If you choose to provide it, this will be used for giving the user attribution for their work.', # Email sending 'pear-mail-error' => '$1', # do not translate or duplicate this message to other languages diff --git a/languages/messages/MessagesQqq.php b/languages/messages/MessagesQqq.php index 62b50d4255..f7501b9f17 100644 --- a/languages/messages/MessagesQqq.php +++ b/languages/messages/MessagesQqq.php @@ -1370,6 +1370,8 @@ See also: 'loginlanguagelabel' => 'Used on [[Special:UserLogin]] if $wgLoginLanguageSelector is true. $1 is a pipe-separated list built from the names that appear in the message {{msg-mw|Loginlanguagelinks}}. {{Identical|Language}}', 'suspicious-userlogout' => 'Used when the logout request looks suspicious, in Special:UserLogout.', +'createacct-another-realname-tip' => 'Used on the account creation form when creating another user\'s account. Similar to {{mw-msg|prefs-help-realname}}. +{{Identical|Real name attribution}}', # Email sending 'php-mail-error-unknown' => 'Used as error message when mail() returned empty error message.', diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index c266f89f48..5a420912a0 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -564,6 +564,7 @@ $wgMessageStructure = array( 'loginlanguagelabel', 'loginlanguagelinks', 'suspicious-userlogout', + 'createacct-another-realname-tip', ), 'mail' => array( 'pear-mail-error', -- 2.20.1